<?php
    include_once("checkAuthenticationAction.php");
    include_once("../service/userService.php");
    $title = $_POST["usergroupTitle"];
	$privileges = isset($_POST["privileges_cbx"])?$_POST["privileges_cbx"]:array();
    $newid = createGroupDetail($title);
    if(unassignAllPermissionOfUserGroup($newid)){
        assignPermissionOfUserGroup($newid,$privileges);    
    }
	echo "<script>window.location.href='../admin/user-group.php';</script>";
    
?>